<template>
  <button @click="show = !show">显示/隐藏</button>
  <transition name="slide">
    <div v-if="show" class="dv">滑动进入效果</div>
  </transition>
</template>

<script setup>
import { ref } from "vue";

let show = ref(false);
</script>

<style>
.dv {
  margin-top: 20px;
  padding: 30px;
  width: 200px;
  background-color: burlywood;
  color: cadetblue;
}
.slide-enter-active {
  transition: all 1.8s ease-out;
}

.slide-leave-active {
  transition: all 3.2s ease-in;
}

.slide-enter-from {
  transform: translateX(-100px) translateY(-100px);
  opacity: 0;
}

.slide-leave-to {
  transform: translateX(300px) translateY(-100px);;
  opacity: 0;
}

</style>
